1. Home
  2. Mac OS X
  3. Run an applescript when a bluetooth device goes in out of range on mac

Run An AppleScript When A Bluetooth Device Goes In/Out Of Range On Mac

A couple of months back, we reviewed Bluetooth Screen Lock (detailed here). The app allows you to lock your screen whenever a specific Bluetooth device paired with your Mac goes out of range. It is one of the best ways of ensuring you never forget to lock your system when you leave. Bluetooth Proximity Tasker is a Mac app worth $1.99 in the Mac App Store and developed by the same developer who made Bluetooth Screen Lock. The app works on the same principal, except that it allows you to run a AppleScript when a Bluetooth enabled device comes in or goes out of range. Unlike the previously covered app, this one allows you to perform different actions for when the device is in range and when it leaves range. You can run one or several scripts for each action. Although slightly pricier than the previous app, it offers more functionality.

Note: When Bluetooth Screen Lock was covered, readers sounded off in comments that the app wasn’t working and were unable to get it to detect an iPhone. Both Bluetooth Screen Lock and Bluetooth Proximity Tasker have been tested and they work. It is best that you pair your device with your Mac first, and then launch the app.

Download and install the app. Pair your device with your Mac, and then launch Bluetooth Proximity Tasker. Click Bluetooth Device, select the device you want to associate with the app and click Select.

Bluetooth Proximity Tasker device

The signal bar will show you the strength of the signal between your Mac and the device you’ve selected. Use the slider below the Signal bar to select how weak the signal should be for the app to treat is as ‘Out of Range’.

Next, enter the AppleScript you want to run when the device comes in range in In Range AppleScript, and the one you want to run when it is out of range in, obviously, Out Of Range AppleScript. In the Delay field, enter the time (in seconds) that the app should wait for before running the scripts.

Bluetooth Proximity Tasker

Click Save when you’re done, and restart the app for changes to take effect. Please note that you will not have to pair with your Mac each time you turn the system on, but Bluetooth needs to be enabled on both your Mac and whichever device you’ve decided to use as a trigger. By default, the app comes with sample commands ‘Beep’ that you can delete to add your own scripts. The scripts don’t need to be compiled in Automater, and will run from Bluetooth Proximity Tasker itself.

The app was tested using iPhone 4S and iPhone 4, both running iOS 5.1.1, and Mac mini running OS X 10.7.4.

Get Bluetooth Proximity Tasker From Mac App Store